package com.chaopei.myobj;

import com.sun.corba.se.impl.ior.OldJIDLObjectKeyTemplate;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author Corday 天涯
 * @Date 2022/3/8 9:23
 */
public class MyObject {
    /**
     * @param args
     */
    public static void main(String[] args) {
//  Object对象的管理,是所有类的基类或超类，有公共的方法
//所有的子类默认继承了Object
        Object obj = new Object();
//equals(),toString(),hashCode(),wait(),notify(),notifyAll()
        //instanceof()
        //1.验证equals与hashCode的作用
        Set set = new HashSet();
        Student stu = new Student(101, "mary", "女");
        Student stu1 = new Student(101, "mary", "女");
        Student stu2 = new Student(101, "mary", "女");
        set.add(stu);
        set.add(stu1);
        set.add(stu2);
        for(Object o:set){
            System.out.println(o);
        }
//   2.equals()用于判断对象的内容
        System.out.println("--------------------");
        System.out.println(stu.equals(stu1));
        System.out.println(stu==stu1);
        System.out.println(stu instanceof Object);
        System.out.println(obj instanceof Student);

    }
}
